<!-------- @HEADER
 !
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 !  Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
 !                  Copyright 2012 Sandia Corporation
 !
 ! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 ! the U.S. Government retains certain rights in this software.
 !
 ! Redistribution and use in source and binary forms, with or without
 ! modification, are permitted provided that the following conditions are
 ! met:
 !
 ! 1. Redistributions of source code must retain the above copyright
 ! notice, this list of conditions and the following disclaimer.
 !
 ! 2. Redistributions in binary form must reproduce the above copyright
 ! notice, this list of conditions and the following disclaimer in the
 ! documentation and/or other materials provided with the distribution.
 !
 ! 3. Neither the name of the Corporation nor the names of the
 ! contributors may be used to endorse or promote products derived from
 ! this software without specific prior written permission.
 !
 ! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 ! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 ! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 ! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 ! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 ! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 !
 ! Questions? Contact Karen Devine	kddevin@sandia.gov
 !                    Erik Boman	egboman@sandia.gov
 !
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 ! @HEADER
-------> 

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.7 sun4u) [Netscape]">
   <meta name="sandia.approved" content="SAND99-1376">
   <meta name="author" content="karen devine, kddevin@sandia.gov">
   <title> Zoltan Developer's Guide:  Adding Interface Routines</title>
</head>
<body bgcolor="#FFFFFF">

<div ALIGN=right><b><i><a href="dev.html">Zoltan Developer's Guide</a>&nbsp; |&nbsp; <a href="dev_add_lb.html">Next</a>&nbsp; |&nbsp; <a href="dev_add.html">Previous</a></i></b></div>


<h2>
<a NAME="new_interface"></a>Load-Balancing Interface Routines</h2>
Any new method that you wish to add to the Zoltan library must have an
interface that conforms to the prototype <b><a href="dev_add_lb.html">LB_FN</a></b>.
Note that the load balancing
function may return either import lists, export lists, or both. All
processes must return the same type of list. If import (export) lists
are not computed, then the variable <i>num_import</i> (<i>num_export</i>)
must be set to a negative number (typically -1) upon return.
Full support of the <a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a>
parameter is not required.  
If <a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a> 
is not set to NONE,
the new algorithm may return either import or export lists; the Zoltan 
interface will then build the lists requested by
<a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a>.

<p>
A new algorithm must be added to the load-balancing interface for use
with parameter
<a href="../ug_html/ug_alg.html#LB_METHOD">LB_METHOD</a>.
An entry for the new algorithm must be added to the enumerated type <b>Zoltan_LB_Method</b>
in <i>lb/lb_const.h</i>. An external <b><a href="dev_add_lb.html">LB_FN</a></b>
prototype for the load-balancing function must also be added to <i>lb/lb_const.h</i>;
see the prototype for function <i>Zoltan_RCB</i> as an example. A character
string describing the new algorithm should be chosen to be used as the parameter
value for 
<a href="../ug_html/ug_alg.html#LB_METHOD">LB_METHOD</a>.
In 
function <b>Zoltan_LB_Set_LB_Method</b>,
a test for this string should be added
and the <i>Method</i> and <i>LB_Fn</i> fields of the <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
should be set to the new enumerated type value and new load-balancing function
pointer.
<br>&nbsp;
<p>
<hr WIDTH="100%">
<br>[<a href="dev.html">Table of Contents</a>&nbsp; |&nbsp; <a href="dev_add_lb.html">Next:&nbsp;
Load-Balancing Function Implementation</a>&nbsp; |&nbsp; <a href="dev_add.html">Previous:&nbsp;
Adding New Algorithms</a>&nbsp; |&nbsp; <a href="https://www.sandia.gov/general/privacy-security/index.html">Privacy and Security</a>]
</body>
</html>
